<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" th:href="@{/css/index/main.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/layui.css}">
    <script type="text/javascript" th:src="@{/js/layui.js}"></script>
    <script src="js/jquery.min.js"></script>
</head>
<body>

<div th:insert="~{details::top}"></div>
<div th:insert="~{details::header}"></div>

<div class="content content-nav-base datails-content" >
<div th:insert="~{details::label}"></div>

    <div class="data-cont-wrap w1200">
        <div th:insert="~{details::crumb}"></div>
        <div th:insert="~{details::product}"></div>
    </div>
</div>

<script src="js/detail.js"></script>
<script>
    window.onload=function ()
    {

        $.ajax({
            url:"/setProduct",
            success:function (data) {
                if (data.aprice==0)
                {

                    document.getElementById("aprice").style.display="none";//动态显示标签
                    document.getElementById("activity").style.display="none";//动态显示标签
                    document.getElementById("iprice").style.display="none";//动态显示标签
                    document.getElementById("p").style.display="none";//动态显示标签
                    document.getElementById("iiprice").innerText=data.iprice+"元";
                }
                else
                {
                    document.getElementById("iiprice").style.display="none";//动态显示标签
                    document.getElementById("iii").style.display="none";//动态显示标签
                    document.getElementById("iprice").innerText=data.iprice+"元";
                    document.getElementById("aprice").innerText=data.aprice+"元";
                }

                document.getElementById("pimg").src=data.paddress;

                document.getElementById("pname").innerText=data.pname;

                // document.getElementById("i").innerText="123";动态显示文字
                console.log(data.id);
                console.log(data.pname);
                console.log(data.iprice);
                console.log(data.paddress);

            }
        })
    }
// document.getElementById("pimg").src="/images/product/乐事.jpg";
// document.onload=function (){
//     $.ajax({
//         url:"/selProduct",
//     })
//     // document.getElementById("pimg")=
// }
// function setProduct()
// {
//     alert("setProduct");
// }


</script>



</body>
</html>